package com.wang.seckill.config;

import com.wang.seckill.pojo.User;

public class UserContext {

    //每个线程都有自己的threadlocal，共享数据存在这里
    private static ThreadLocal<User> userHolder = new ThreadLocal<>();

    public static void setUser(User user) {
        userHolder.set(user);
    }

    public static User getUser() {
        return userHolder.get();
    }

}
